<%@ page language="java" contentType="text/html; charset=UTF-8"%>

<!DOCTYPE html>
<html>
	<head>
		<title>商城后台_分类管理</title>
		<%@include file="../header.jsp" %>
		<style>
			body{padding-top: 70px;}
			._category{width: 50px;height: 25px;border: 1px solid #DDDDDD;border-radius: 5px;text-align: center;line-height: 25px;}
			._category_add{width: 100px;height: 25px;line-height: 25px;margin-top: 3px;}
		</style>
	</head>
	<body>
		<%@include file="top.jsp" %>
		
		<div class="container">
			<s:iterator value="categoryList" status="st">
				<div class="row-fluid">
					<div class="span1">
						<div class="_category">
							<s:property value="name"/>
						</div>
						<div class="_category_add">
							<button class="btn btn-success" onclick="addCategory('<s:property value="id"/>')">增加分类</button>
						</div>
					</div>
					<div class="span6">
						<table class="table table-bordered table-condensed">
	 						<thead>
	 							<tr>
	 								<td>#</td>
	 								<td>分类名</td>
	 								<td>描述</td>
	 								<td>操作</td>
	 							</tr>
	 						</thead>
	 						<tbody id="datas">
	 							<s:iterator value="children" status="st">
		 							<tr id='tr1'  ondblclick="dataShow('tr1')">
		 								<td><s:property value="#st.index"/></td>
		 								<td><s:property value="name"/></td>
		 								<td><s:property value="description"/></td>
		 								<td><a style="color:red;" href="javascript:deleteCategory('<s:property value="id"/>')">删除</a> </td>
		 							</tr>
	 							</s:iterator>
	 						</tbody>
						</table>
					</div>
				</div>
			</s:iterator>
		
			
			
			<div class="row">
				<div class="span2 offset2">
					<button class="btn btn-info" onclick="alert('这个太麻烦不好做,所以决定不实现这个功能')">增加一级分类</button>
				</div>				
			</div>
		</div>
		
		<script>
			$('.dropdown-toggle').dropdown();

			function addCategory(id){
				window.location ="${basePath}admin_toAddCategoryUI.action?pcategory.id="+id;				
			}
			function deleteCategory(id){
				window.location ="${basePath}admin_deleteCategory.action?category.id="+id;				
			}
		</script>
	</body>
</html>
